<extend name="Public/base"/>

<block name="body">
    <header class="ui-header ui-header-positive ui-border-b">
        <i class="ui-icon-return" onclick="logout()" style="font-size: 14px;">退出</i>
        <h1>{$meta_title}</h1>
        <button class="ui-btn" onclick="go_crt()">创建</button>
    </header>
    <section class="ui-container">
        <div class="demo-item">
            <p class="demo-desc">介绍列表</p>
            <div class="demo-block">
                <table class="ui-table ui-border">
                    <thead>
                    <tr><th>学生</th><th>家长/电话</th><th>时间</th></tr>
                    </thead>
                    <tbody>
                    <volist name="_list" id="vo">
                    <tr><td>{$vo.name}</td><td>{$vo.parent_name}/{$vo.parent_phone}</td><td>{$vo.create_time|date="y-m-d",###}</td></tr>
                    </volist>
                    </tbody>
                </table>
            </div>
        </div>

    </section><!-- /.ui-container-->

</block>

<block name="script">
    <script type="text/javascript">
        var p = 1;
        $(document).ready(function(){
            $("#ui-loading").hide();
        });
        //详情页
        function go_detail(id) {
            window.location.href = '{:U("detail")}'+"&id="+id;
        }
        
        //创建
        function go_crt() {
            window.location.href = '{:U("add")}';
        }

        //登出
        function logout() {
            window.location.href = '{:U("Public/logout")}';
        }

        //点击加载更多
        function load_more() {
            $("#ui-loading").show();
            p++;
            $.ajax({
                type: "post",
                url: "{:U('loadMore')}",
                data: "p=" + p ,
                success: function (result) {
                    if (result.status == 1) {
                        var list = result.data;
                        var html = "";
                        for(var i in list){
                            var is_use = "";
                                is_use = list[i].status==1?'<div class="ui-list-action" style="width:48px"></div>':'<div class="ui-list-action" style="color:#F90">已使用</div>';
                            html += '<li class="ui-border-t" onclick="go_detail('+list[i].id+')"><div class="ui-list-info"><h4 class="ui-nowrap">'+list[i].temp_title+'</h4><p class="ui-nowrap">&nbsp;'+list[i].remark+'</p></div>'+is_use+'<div class="ui-list-action" style="width:48px"></div></li>';
                        }
                        $("#content_list").append(html);
                        $("#ui-loading").hide();
                    } else {
                        $(".ui-loading-wrap").hide();
                    }
                }
            });
        }

    </script>
</block>